﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using DormMS.IService.Common;
using DormMS.Service;
using DormMS.IService;
using Infrastructure;
using NLog;
using DormMS.Model;

namespace DormMS.Controllers
{
    public class DormAdjustController : BaseController
    {
        protected ILogService logService;
        private static Logger NLog = LogManager.GetLogger("Request");
        private IDormAdjustService dormAdjustService;
        protected IUserInfoService userInfoService;
        protected IStudentBedService studentBedService;

        public DormAdjustController(IUserInfoService s, ILogService l, IDormAdjustService d, IStudentBedService b) : base(s)
        {
            logService = l;
            dormAdjustService = d;
            userInfoService = s;
            studentBedService = b;
        }

        // GET: DormAdjust
        public ActionResult Index()
        {
            return View();
        }

        public ActionResult GetDormAdjust(int id)
        {
            return Json(dormAdjustService.GetDormAdjust(id));
        }

        public ActionResult AddDormAdjust(DormAdjust model)
        {
            return Json(dormAdjustService.AddDormAdjust(model));
        }

        public ActionResult UpdateStudentBedInfo(StudentBed model, int? bedId)
        {
            if(bedId == null)
                return Json(studentBedService.StudentBedEdit(model, null));
            else
                return Json(studentBedService.StudentBedEdit(model, bedId));
        }
    }
}